package tj.eskhata.pos.dao.hibernate;

import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.Date;
import java.util.List;

import tj.eskhata.pos.dao.SostDao;
import tj.eskhata.pos.domain.Client;
import tj.eskhata.pos.domain.Sost;

public class SostDaoImpl extends AbstractHibernateDaoImpl<Sost>
    implements SostDao {

  public SostDaoImpl() {
    super(Sost.class);
  }
  
  public Sost getSost(String code) {
	  Connection con=getSession().connection();
	  Sost object=null;
	  Long id;
	  try {
			CallableStatement clst= con.prepareCall("{?= call SOST#.GETSOST(?,?)}");
						
			clst.registerOutParameter(1, java.sql.Types.NUMERIC);
			
			clst.setString	(2, code);
	        clst.setString	(3, "PS_DOCTRANS");
	        
	          	        	
	          	        	
	        clst.execute();
	        object=load(clst.getLong(1));
	        //object.setId(clst.getLong(1));
		  } catch (SQLException e) {			
			e.printStackTrace();
		  }		  
		  
		  return object;

  }
}
